<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Drag and drop of image to scrollable container with horizontal scrollbar</title>
<style type="text/css">
p + div
  {height:150px;
  width:150px;
  overflow-x:scroll;}
div[ondragenter]
  {margin-left:200px;
  width:105px;
  min-height:105px;
  text-align:center;
  padding:10px;
  background-color:silver;}
p:first-child
  {padding-left:12px;}
</style>
<script type="application/ecmascript">
function addImage(event)
  {var c = document.createElement('img');
  c.setAttribute('src',event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,''));
  document.querySelector('div > div').appendChild(c);}
</script>
</head>
<body>
<p><img src="" alt="PNG circle" ondragstart="event.dataTransfer.effectAllowed = 'copy'"/></p>
<p>Drag circle above to the silver box inside scrollable container below (dragging towards edge of container triggers scrolling).</p>
<p>It should be copied to the silver box once you drop it there.</p>
<div>
  <div
    ondragenter="event.preventDefault()"
    ondragover="return false"
    ondrop="addImage(event)"
  />
</div>
</body>
</html>
